package com.walkline.travelassistant.dao;

import org.json.me.JSONObject;

import com.walkline.travelassistant.TravelAssistantException;
import com.walkline.travelassistant.TravelAssistantSDK;
import com.walkline.travelassistant.inf.Route;
import com.walkline.travelassistant.inf.StepWrapper;
import com.walkline.util.Function;

public class TravelAssistantRoute extends TravelAssistantObject implements Route
{
	private int _distance = 0;
	private String _distance_str = "";
	private StepWrapper _steps = null;

	public TravelAssistantRoute(TravelAssistantSDK travelAssistant, JSONObject jsonObject) throws TravelAssistantException
	{
		super(travelAssistant, jsonObject);

		JSONObject routeObject = jsonObject;
		if (routeObject != null)
		{
			_distance = routeObject.optInt("distance");
			_distance_str = Function.convertDistance2String(_distance);
			_steps = new TravelAssistantStepWrapper(travelAssistant, routeObject);
		}
	}

	public int getDistance() {return _distance;}

	public String getDistanceStr() {return _distance_str;}

	public StepWrapper getSteps() {return _steps;}
}